﻿using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Configuration.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DFGK_WMS.Common
{
    /// <summary>
    /// 加载配置文件
    /// </summary>
    public static class Config
    {
        private static IConfiguration GetConfig()
        {
            return new ConfigurationBuilder()
                .Add(new JsonConfigurationSource { Path = "appsettings.json", ReloadOnChange = true })
                .Build();
        }
        private static IConfiguration AppSettings => GetConfig();
        /// <summary>
        /// Wcs
        /// </summary>
        public static string WcsBaseUrl => AppSettings.GetValue<string>("WcsBaseUrl") ?? string.Empty;
        /// <summary>
        /// 是否为测试环境
        /// </summary>
        public static bool IsDev => AppSettings.GetValue<bool>("IsDev");
        public static bool IsDevErp => AppSettings.GetValue<bool>("IsDevErp");

        /// <summary>
        /// 是否有补货环节
        /// </summary>
        public static bool IsReplenishment => AppSettings.GetValue<bool>("IsReplenishment");
    }
}
